//
//  NewsMianListViewController.m
//  Nidalee
//
//  Created by 李康 on 2020/12/3.
//  Copyright © 2020 李康. All rights reserved.
//

#import "NewsMianListViewController.h"
#import <MJCSegmentInterface/MJCSegmentInterface.h>
#import "NewsListViewController.h"

@interface NewsMianListViewController ()<MJCSegmentDelegate>

@property (nonatomic, strong) MJCSegmentInterface *mainSegmentView;

@property (nonatomic, strong) NewsListViewController *newsListVC1;
@property (nonatomic, strong) NewsListViewController *newsListVC2;
@property (nonatomic, strong) NewsListViewController *newsListVC3;
@property (nonatomic, strong) NewsListViewController *newsListVC4;

@end

@implementation NewsMianListViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self addLeftImgBarButtonByItemImg:@"loginBack"];
    [self createUI];
}

-(void) createUI{
    self.newsListVC1 = [[NewsListViewController alloc]init];
    self.newsListVC2 = [[NewsListViewController alloc]init];
    self.newsListVC3 = [[NewsListViewController alloc]init];
    self.newsListVC4 = [[NewsListViewController alloc]init];
    
    self.mainSegmentView = [MJCSegmentInterface jc_initWithFrame:CGRectMake(0,0,ScreenWidth, ScreenHeight -NavigationBarHeight) titlesArray:@[@"市场要闻",@"名家评论",@"外盘行情",@"大盘走向"] childControllerArray:@[self.newsListVC1,self.newsListVC2,self.newsListVC3,self.newsListVC4] interFaceStyleToolsBlock:^(MJCSegmentStylesTools *jc_tools) {
        jc_tools.
        jc_titlesViewBackColor([UIColor whiteColor]).
        jc_loadAllChildViewEnabled(YES).
        jc_titleBarStyles(MJCTitlesScrollStyle).
        jc_itemTextNormalColor(HexColor(0x999999)).
        jc_itemTextSelectedColor(HexColor(0x709cfa)).
        jc_itemTextFontSize(15).
        jc_indicatorFollowEnabled(YES).
        jc_indicatorColorEqualTextColorEnabled(YES).
        jc_itemSelectedSegmentIndex(0).
        jc_childScollEnabled(YES).
        jc_indicatorFrame(CGRectMake(0, 50-12, 80, 2)).
        jc_indicatorsAnimalsEnabled(YES).
        jc_childScollAnimalEnabled(YES).
        jc_itemTextGradientEnabled(YES).
        jc_titlesViewFrame(CGRectMake(0, 0, ScreenWidth, 45)).
        jc_titlesViewBackImage([UIImage imageNamed:@"GLYinYing.png"]);
        
    } hostController:self];
    self.mainSegmentView.delegate = self;
    [self.view addSubview:self.mainSegmentView];
    
}
- (void)setIndex:(NSInteger)index{
    _index = index;
    [self.mainSegmentView setSelectedSegmentIndex:index]; 
}

@end
